/*!
 * \file Timer.h
 * \brief Base class for Timers
 */

#ifndef TSC_TIMER_H
#define TSC_TIMER_H

#include <stdint.h>
#include "RequestHandler.h"
#include "common.pb.h"

namespace tsc
{
namespace common
{

enum TimerType_e
{
    TIMER_TYPE_UAP,
    TIMER_TYPE_GAP
};

/**
 * Base class for Timers
 */
class Timer
{
public:
    Timer(RequestHandler* pReqHandler,
          uint32_t        generatorId,
          unsigned int    timerId,
          TimerType_e     type);

	virtual ~Timer();

	void start(unsigned long value);

	void cancel();

private:
	RequestHandler* mpReqHandler;

	uint32_t mGeneratorId;

	unsigned int mTimerId;
	/**
	 * ID assigned when the timer is started and can be used to
	 * cancel it while running
	 */
	unsigned int mCancelTimerId;

	TimerType_e mType;
};

} // namespace common
} // namespace tsc

#endif // TIMER_H
